package org.example.admin.service;

import org.example.common.utils.DateTimeUtil;
import org.example.db.entity.Collect;
import org.example.db.entity.FootPrint;
import org.example.db.entity.WxUser;
import org.example.db.mapper.CollectMapper;
import org.example.db.mapper.FootPrintMapper;
import org.example.db.mapper.WxUserMapper;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class AdminWxUserService {
    WxUserMapper wxUserMapper;
    FootPrintMapper footPrintMapper;
    CollectMapper collectMapper;

    public AdminWxUserService(WxUserMapper wxUserMapper, FootPrintMapper footPrintMapper, CollectMapper collectMapper) {
        this.wxUserMapper = wxUserMapper;
        this.footPrintMapper = footPrintMapper;
        this.collectMapper = collectMapper;
    }
    public List<WxUser> getWxUserList(){
        return wxUserMapper.selectList(null);
    }

    public int updateWxUser(WxUser wxUser){
        String time = DateTimeUtil.getDateTimeString(LocalDateTime.now());
        wxUser.setAddTime(time);
        wxUser.setUpdateTime(time);
        return wxUserMapper.updateById(wxUser);
    }

    public List<FootPrint> getFootPrintList(){
        return footPrintMapper.selectList(null);
    }

    public List<Collect> getCollectList(){
        return collectMapper.selectList(null);
    }
}
